package com.example.q_kang.hhh.order;

import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.base.BasePresenter;
import com.sskj.base.base.HttpData;
import com.sskj.base.bean.PiPeiStatusListBean;
import com.example.q_kang.hhh.api.JsonConverter;

import java.util.List;

import io.reactivex.Flowable;


/**
 * @author Hey
 * Create at  2019/04/13
 */
class MatchListPresenter extends BasePresenter<MatchListActivity> {

    public Flowable<List<PiPeiStatusListBean.PiPeiStatusBean>> getSellPiPeiStatus(int page, String order) {
        return httpService.getSellPiPeiStatus(page, order)
                .tag(this)
                .converter(new JsonConverter<HttpData<PiPeiStatusListBean>>() {
                })
                .adapt(new FlowableBody<>())
                .map(listHttpData -> listHttpData.getData().getList());
    }

    public Flowable<List<PiPeiStatusListBean.PiPeiStatusBean>> getBuyPiPeiStatus(int page, String order) {
        return httpService.getBuyPiPeiStatus(page, order)
                .tag(this)
                .converter(new JsonConverter<HttpData<PiPeiStatusListBean>>() {
                })
                .adapt(new FlowableBody<>())
                .map(listHttpData -> listHttpData.getData().getList());
    }

    public Flowable<List<PiPeiStatusListBean.PiPeiStatusBean>> getBuyCompleteStatus(int page, String order) {
        return httpService.getBuyCompleteStatus(page, order)
                .tag(this)
                .converter(new JsonConverter<HttpData<PiPeiStatusListBean>>() {
                })
                .adapt(new FlowableBody<>())
                .map(listHttpData -> listHttpData.getData().getList());
    }
}
